//
//  CarManrgerDatePickViewController.m
//  Runone
//
//  Created by runone02 on 16/12/14.
//  Copyright © 2016年 runone. All rights reserved.
//

#import "CarManrgerDatePickViewController.h"
#import "RODatePickerView.h"

@interface CarManrgerDatePickViewController ()<RODatePickViewDelegate>

@property (nonatomic, strong) RODatePickerView *pickerV;//时间选择器

@end

@implementation CarManrgerDatePickViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.preferredContentSize =  CGSizeMake([UIScreen mainScreen].bounds.size.width - 16, 230);
    CGRect  rect = CGRectMake(0.0, 0.0, [UIScreen mainScreen].bounds.size.width - 16, 230);
   
    _pickerV = [[RODatePickerView alloc] initWithFrame:rect delegate:self datePickerStyle:RODatePickerStyleYearMonthDayHourMinuteSecond datePickViewPushModel:RODatePickerViewPushModelBottom] ;
     __weak __typeof(self)weakSelf = self;
    _pickerV.cancleBlock = ^(UIButton *btn) {
        [weakSelf dismissViewControllerAnimated:YES completion:nil];
    };
    [self.view addSubview:_pickerV];
}



#pragma mark - RODatePickerDelegate
- (void)datePicker:(RODatePickerView *)datePicker didSelectDate:(RODatePickerDataModel *)datePickerDate {
    NSString *dateStr = [NSString stringWithFormat:@"%@-%@-%@ %@:%@:%@",
                         datePickerDate.yearStr,
                         datePickerDate.monthStr,
                         datePickerDate.dayStr,
                         datePickerDate.hourStr,
                         datePickerDate.minStr,
                         datePickerDate.secondStr
                         ];
    self.passTimeStrBlok(dateStr);
}

@end
